// app.js
const {requestGlobalOptions} = require("./we7/js/request");
App({
  onLaunch() {
    wx.login({
      success: res => {
        this.globalData.code = res.code 
      }
    })

    requestGlobalOptions.success = function (data,resolve,reject) {
      if (data?.code === 0){
        if (data?.message !== ""){
          wx.showToast({
            title:data.message,
            icon: "success"
          })
        }
        resolve(data.data)
      }else{
        wx.showToast({
          title:data.message,
          icon: "error"
        })
        reject(data.message)
      }
    }
  },
  globalData: {
    code: null,
    login: false,
    userInfo: null
  },
  apis: require('./we7/apis/index')
})
